package DBPool

const (
	CONNECTIONS_NUM_PER_DATABASE = 16
	DATABASE_NUM                 = 2
	QUERY_CHAN_SIZE_PER_DATABASE = 2048
)

var (
	DBPOOLCONFIG = NewDBPoolConfig()
)

type DBAuthInfo struct {
	User     string
	Password string
	Address  string
	Port     string
	Name     string
}

type DBPoolConfig struct {
	Authors       []*DBAuthInfo
	ConnSizePerDB uint32
	QueryChanSize uint32
}

func NewDBPoolConfig() *DBPoolConfig {
	dbconfig := &DBConfig{}
}

/*
 *  just make a simulation
 */
func (this *DBPoolConfig) LoadConfig(fileName string) {
	this.ConnSizePerDB = CONNECTIONS_NUM_PER_DATABASE

	this.QueryChanSize = QUERY_CHAN_SIZE_PER_DATABASE

	this.Authors = make([]*DBAuthInfo, DATABASE_NUM)

	for i, _ := range this.Authors {
		this.Authors[i] = &DBAuthInfo{
			User:     "root",
			Password: "12345",
			Address:  "127.0.0.1",
			Port:     "3308",
			Name:     "ngame013",
		}
	}
}
